﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace BankSystemWithCSharp
{
    public partial class LoginPanel : UserControl
    {
        private ILogin login = new LoginController();
        private Action LoginSuccess;
        public LoginPanel(Action loginSuccess)
        {
            InitializeComponent();
            LoginSuccess = loginSuccess;
        }

        public void Clear()
        {
            accountTextBox.Text = string.Empty;
            passwordTextBox.Text = string.Empty;
        }

        private void loginButton_Click(object sender, EventArgs e)
        {
            if (login.Login(accountTextBox.Text, passwordTextBox.Text)){
                LoginSuccess();
            }
        }
    }
}
